/*
 * @Description: 确认金额   ConfirmedAmount
 * @version: 
 * @Company: 
 * @Author: ZhengZhuang
 * @Date: 2019-08-28 17:50:49
 * @LastAuthor   : zhengzhuang
 * @lastTime     : 2020-01-02 09:03:19
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:C20Driver/service/request.dart';
import 'package:C20Driver/utils/utils.dart';

class ConfirmedAmount extends StatefulWidget {
  final String orderId;
  final String sumCost;
  final String startCost;
  final String timeCost;
  final String distanceCost;
  ConfirmedAmount(
      {this.orderId,
      this.sumCost,
      this.startCost,
      this.timeCost,
      this.distanceCost});
  @override
  _ConfirmedAmountState createState() => _ConfirmedAmountState();
}

class _ConfirmedAmountState extends State<ConfirmedAmount> {
  String roadToll = '0.00'; // 过路费
  String parkingRate = '0.00'; // 停车费

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      child: Scaffold(
        resizeToAvoidBottomPadding: false, //输入框抵住键盘
        appBar: AppBar(
          title: Text('确认账单'),
        ),
        body: Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Center(
                child: Column(
                  children: <Widget>[
                    SizedBox(
                      height: ScreenUtil().setWidth(220.0),
                    ),
                    RichText(
                      text: TextSpan(
                        text: widget.sumCost,
                        style: TextStyle(
                          fontSize: ScreenUtil().setSp(72.0),
                          color: Colors.black,
                          fontWeight: FontWeight.w700,
                        ),
                        children: <TextSpan>[
                          TextSpan(
                            text: '元',
                            style: TextStyle(
                              fontSize: ScreenUtil().setSp(34.0),
                              color: Colors.black54,
                            ),
                          ),
                        ],
                      ),
                    ),
                    // SizedBox(height: ScreenUtil().setWidth(30.0)),
                    // Text(
                    //   '若行程中产生附加费',
                    //   style: TextStyle(
                    //     fontSize: ScreenUtil().setSp(28.0),
                    //     color: Colors.black54,
                    //   ),
                    // ),
                    // Text(
                    //   '请您先与乘客确认后添加',
                    //   style: TextStyle(
                    //     fontSize: ScreenUtil().setSp(28.0),
                    //     color: Colors.black54,
                    //   ),
                    // ),
                    // SizedBox(height: ScreenUtil().setWidth(80.0)),
                    // Container(
                    //   width: ScreenUtil().setWidth(710.0),
                    //   height: ScreenUtil().setWidth(100.0),
                    //   padding: EdgeInsets.only(
                    //     left: ScreenUtil().setWidth(30.0),
                    //     right: ScreenUtil().setWidth(30.0),
                    //   ),
                    //   color: Colors.white,
                    //   child: Row(
                    //     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    //     children: <Widget>[
                    //       Text('过路费'),
                    //       Row(
                    //         children: <Widget>[
                    //           Container(
                    //             width: ScreenUtil().setWidth(400.0),
                    //             child: TextField(
                    //               keyboardType: TextInputType.number,
                    //               textAlign: TextAlign.right,
                    //               decoration: InputDecoration(
                    //                   border: InputBorder.none,
                    //                   hintText: '请输入金额'),
                    //               cursorColor: Colors.black,
                    //               cursorWidth: 1,
                    //               autofocus: false,
                    //               onChanged: (val) {
                    //                 setState(() {
                    //                   roadToll = val;
                    //                 });
                    //               },
                    //             ),
                    //           ),
                    //           SizedBox(width: ScreenUtil().setWidth(10.0)),
                    //           Text('元'),
                    //         ],
                    //       ),
                    //     ],
                    //   ),
                    // ),
                    SizedBox(height: ScreenUtil().setWidth(30.0)),
                    // Container(
                    //   width: ScreenUtil().setWidth(710.0),
                    //   height: ScreenUtil().setWidth(100.0),
                    //   padding: EdgeInsets.only(
                    //     left: ScreenUtil().setWidth(30.0),
                    //     right: ScreenUtil().setWidth(30.0),
                    //   ),
                    //   color: Colors.white,
                    //   child: Row(
                    //     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    //     children: <Widget>[
                    //       Text('停车费'),
                    //       Row(
                    //         children: <Widget>[
                    //           Container(
                    //             width: ScreenUtil().setWidth(400.0),
                    //             child: TextField(
                    //               keyboardType: TextInputType.number,
                    //               textAlign: TextAlign.right,
                    //               decoration: InputDecoration(
                    //                   border: InputBorder.none,
                    //                   hintText: '请输入金额'),
                    //               cursorColor: Colors.black,
                    //               cursorWidth: 1,
                    //               autofocus: false,
                    //               onChanged: (val) {
                    //                 setState(() {
                    //                   parkingRate = val;
                    //                 });
                    //               },
                    //             ),
                    //           ),
                    //           SizedBox(
                    //             width: ScreenUtil().setWidth(10.0),
                    //           ),
                    //           Text('元'),
                    //         ],
                    //       ),
                    //     ],
                    //   ),
                    // ),
                  ],
                ),
              ),
              MaterialButton(
                child: Text(
                  '发起收款',
                  style: TextStyle(
                    fontSize: ScreenUtil().setSp(36.0),
                    color: Colors.white,
                  ),
                ),
                minWidth: ScreenUtil().setWidth(750.0),
                height: ScreenUtil().setWidth(120.0),
                color: Color.fromARGB(255, 255, 153, 0),
                onPressed: () => Request.orderInitiateCollectionFun(
                    context: context,
                    orderId: widget.orderId,
                    roadToll: roadToll,
                    sumCost: widget.sumCost,
                    parkingRate: parkingRate),
              ),
            ],
          ),
        ),
      ),
      onWillPop: () => Utils.orderGoHome(context),
    );
  }
}
